package cn.amaake.magicplugin.nacos.enums;

import com.alibaba.nacos.common.utils.StringUtils;

public enum FileTypeEnum {
    YML("yaml"),
    YAML("yaml"),
    TXT("text"),
    TEXT("text"),
    JSON("json"),
    XML("xml"),
    HTM("html"),
    HTML("html"),
    PROPERTIES("properties");

    private String fileType;
    private static final FileTypeEnum[] VALUES = values();

    private FileTypeEnum(String fileType) {
        this.fileType = fileType;
    }

    public String getFileType() {
        return this.fileType;
    }

    public static FileTypeEnum getFileTypeEnumByFileExtensionOrFileType(String extOrFileType) {
        if (StringUtils.isNotBlank(extOrFileType)) {
            String upperExtName = extOrFileType.trim().toUpperCase();
            FileTypeEnum[] var2 = VALUES;
            int var3 = var2.length;

            for(int var4 = 0; var4 < var3; ++var4) {
                FileTypeEnum value = var2[var4];
                if (value.name().equals(upperExtName)) {
                    return value;
                }
            }
        }

        return PROPERTIES;
    }
}
